import { formatFieldValue } from '@/views/project/utils/formatters.js';

export const descriptionFileds = (response) => {
  // 项目基本信息
  const projectBasicDescs = reactive([
    {
      label: '项目名称',
      content: response.project_name
    },
    {
      label: '项目管理单位',
      content: response.project_management_department
    },
    {
      label: '建设单位',
      content: response.region
    },
    {
      label: '省端项目主管',
      content: response.project_supervisor
    },
  ])

  // 基本信息
  const basicInfoDescs = reactive([
    {
      label: '项目编号',
      content: response.project_number
    },
    {
      label: '项目名称',
      content: response.project_name
    },
    {
      label: '项目化核算编码',
      content: response.project_code
    },
    {
      label: '项目交底人',
      content: response.project_receiver
    },
    {
      label: '项目级别',
      content: response.level
    },
    {
      label: '所属地市',
      content: response.region
    },
    {
      label: '商机名称',
      content: response.business_number
    },
    {
      label: '业务模式',
      content: response.vocational_work_mode
    },
    {
      label: '评审项目名称',
      content: response.project_review_name
    },
    {
      label: '批复项目名称',
      content: response.project_reply_name
    },
    {
      label: '批复文号',
      content: response.reply_number
    },
    {
      label: '批复时间',
      content: response.reply_time
    },
    {
      label: '最终决策级别',
      content: response.approval_type
    },
    {
      label: 'ICT类MIS号(B类编码)',
      content: response.mis_number
    },
    {
      label: '是否使用400万以下流程',
      content: response.four_million_processes ? "是" : "否"
    },
    {
      label: '批复来源',
      content: response.reply_source
    },
    {
      label: '产品编码',
      content: response.product_list
    },
    {
      label: '落地地市',
      content: response.execute_region
    },
    {
      label: '建设模式',
      content: response.construction_mode
    },
    {
      label: '是否纳入PMO管理',
      content: response.pmo ? "是" : "否"
    },
    {
      label: '是否为大单',
      content: response.big_order ? "是" : "否"
    },
    {
      label: '项目管理单位',
      content: response.project_management_department
    },
    {
      label: '项目建设单位',
      content: response.construction_department
    },
    {
      label: '项目流程类型',
      content: response.project_process_type
    },
    {
      label: '管理方式',
      content: response.management_mode
    },
    {
      label: '投资类型',
      content: response.investment_type
    },
    {
      label: '要求完成时间',
      content: response.required_finish_time
    },
    {
      label: '商业模式',
      content: response.business_type
    },
    {
      label: '是否含购销',
      content: formatFieldValue('purchase_and_sale', response.purchase_and_sale)
    },
    {
      label: '项目规模',
      content: response.project_scale
    },
    {
      label: '项目交付复杂度',
      content: response.project_complexity
    },
    {
      label: '自有业务占比',
      content: response.self_business_proportion
    },
    {
      label: '项目收益',
      content: response.project_income
    },
    {
      label: '售前项目等级',
      content: response.project_level
    },
    {
      label: '开工时间',
      content: response.commencement_date
    },
    {
      label: '试运行标题',
      content: response.test_run_title
    },
    // {
    //   label: '项目维护期',
    //   content: response.project_maintenance_period
    // },
    {
      label: '维护起止时间（对业主）',
      content: response.maintenance_start_time_owner && response.maintenance_end_time_owner
        ? response.maintenance_start_time_owner + " - " + response.maintenance_end_time_owner
        : response.maintenance_start_time_owner || response.maintenance_end_time_owner || ""
    },
    {
      label: '维护起止时间（对SI）',
      content: response.maintenance_start_time_si && response.maintenance_end_time_si
        ? response.maintenance_start_time_si + " - " + response.maintenance_end_time_si
        : response.maintenance_start_time_si || response.maintenance_end_time_si || ""
    },
    {
      label: '项目概述',
      content: response.project_overview
    },
    {
      label: '遗留问题记录',
      content: response.legacy_issue_record
    },
    {
      label: '遗留问题整改计划',
      content: response.legacy_issue_correction_plan
    },
    {
      label: '交维结论',
      content: response.handover_and_maintenance_conclusion
    },
    // {
    //   label: '完成时间',
    //   content: response.completion_time
    // },
    // {
    //   label: 'ICT系统交付审核状态',
    //   content: response.dict_system_delivery_audit_status
    // },
    // {
    //   label: 'ICT系统交付审核意见',
    //   content: response.dict_system_delivery_audit_opinion
    // },
    // {
    //   label: '政企运维系统交付审核状态',
    //   content: response.government_enterprise_operations_delivery_audit_status
    // },
    // {
    //   label: '政企运维系统交付审核意见',
    //   content: response.government_enterprise_operations_delivery_audit_opinion
    // }
  ])
  
  // 财务信息
  const financeDescs = reactive([
    {
      label: '资金来源',
      content: response.fund_source
    },
    {
      label: '财务净现值率（%）',
      content: response.expect_annual_rate
    },
    {
      label: '专线部分投资（含税，元）',
      content: response.dedicated_investment_contain
    },
    {
      label: '专线部分投资（除税，元）',
      content: response.dedicated_investment_contain_no_tax
    },
    {
      label: '除专线外部分、使用集客切块资金投资金额（含税，元）',
      content: response.unless_dedicated_investment_contain
    },
    {
      label: '除专线外部分、使用集客切块资金投资金额（除税，元）',
      content: response.unless_dedicated_investment_contain_no_tax
    },
    {
      label: '地市成本（含税，元）',
      content: response.cost_contain
    },
    {
      label: '地市成本（除税，元）',
      content: response.cost_contain_no_tax
    },
    {
      label: '主营业务成本（含税，元）',
      content: response.main_business_cost
    },
    {
      label: '主营业务成本（除税，元）',
      content: response.main_business_cost_no_tax
    },
    {
      label: '非主营业务成本（含税，元）',
      content: response.not_main_business_cost
    },
    {
      label: '非主营业务成本（除税，元）',
      content: response.not_main_business_cost_no_tax
    },
    {
      label: '动态投资收益率（%）',
      content: response.dynamic_investment_rate
    },
    {
      label: '评估结果内部收益率（IRR）',
      content: response.interior_value_rate
    },
    {
      label: '立项批复金额（含税，元）',
      content: response.invest_cost
    },
    {
      label: '立项除税金额（元）',
      content: response.init_cost_no_tax
    },
    {
      label: '维保费（元）',
      content: response.maintenance_cost
    }
  ])

  // 合同信息
  const contractDescs = reactive([
    {
      label: '合同文号',
      content: response.contract_number
    },
    {
      label: '合同开始时间',
      content: response.contract_start_time
    },
    {
      label: '合同结束时间',
      content: response.contract_end_time
    },
    {
      label: '合同要求项目交付时间',
      content: response.contract_delivery_time
    },
    {
      label: '合同金额（含税，元）',
      content: response.amount
    },
    {
      label: '合同金额（除税，元）',
      content: response.amount_no_tax
    },
    {
      label: '是否签订后向合同',
      content: response.retroactive_contract ? "是" : "否"
    },
    {
      label: '前向合同生效时间',
      content: response.forward_contract_effective_time
    }
  ])

  // 客户信息
  const customerDescs = reactive([
    {
      label: '客户名称',
      content: response.customer_name
    },
    {
      label: '客户联系人',
      content: response.customer_contacter_name
    },
    {
      label: '客户联系人电话',
      content: response.customer_contacter_phone
    },
    {
      label: '客户重要程度',
      content: formatFieldValue('customer_importance', response.customer_importance)
    }
  ])

  // 交付团队信息
  const teamDescs = reactive([
    {
      label: '客户经理姓名',
      content: response.customer_manager_name
    },
    {
      label: '客户经理电话',
      content: response.customer_manager_phone,
    },
    {
      label: '客户经理工号',
      content: response.customer_manager_number
    },
    {
      label: '省端项目主管',
      content: response.project_supervisor
    },
    {
      label: '建设单位部门经理',
      content: response.construction_department_manager
    },
    {
      label: '交付经理',
      content: response.construction_project_manager
    },
    {
      label: '解决方案经理姓名',
      content: response.solution_manager_name
    },
    {
      label: '解决方案经理电话',
      content: response.solution_manager_phone
    },
    {
      label: '解决方案经理工号',
      content: response.solution_manager_number
    },
    {
      label: '服务经理',
      content: response.maintenance_manager
    },
    {
      label: '施工单位',
      content: response.construction_unit
    },
    {
      label: '施工单位联系人',
      content: response.construction_unit_contact
    },
    {
      label: '施工单位联系电话',
      content: response.construction_unit_phone
    },
    {
      label: '维护单位',
      content: response.maintenance_unit
    },
    {
      label: '维护单位联系人',
      content: response.maintenance_unit_contact
    },
    {
      label: '维护单位联系电话',
      content: response.maintenance_unit_phone
    },
    {
      label: '业主单位',
      content: response.owner_unit
    },
    {
      label: '业主单位联系人',
      content: response.owner_unit_contact
    },
    {
      label: '业主单位联系电话',
      content: response.owner_unit_phone
    },
    {
      label: '售前支撑的专业公司',
      content: response.pre_sales_support_professional_company
    },
    {
      label: '售中支撑的专业公司',
      content: response.mid_sales_support_professional_company
    },
    {
      label: '售后支撑的专业公司',
      content: response.after_sales_support_professional_company
    },
    {
      label: '实际完成时间',
      content: response.actual_completion_time
    }
  ])

  // 关键人信息
  const keyPersonTableData = reactive([
    {
      role: '客户经理',
      name: response.customer_manager_name,
      work_no: response.customer_manager_number,
      phone: response.customer_manager_phone
    },
    {
      role: '解决方案经理',
      name: response.solution_manager_name,
      work_no: response.solution_manager_number,
      phone: response.solution_manager_phone
    },
    {
      role: '项目交底人',
      name: response.project_receiver,
      id: response.project_receiver_id,
    },
    {
      role: '建设单位部门经理',
      name: response.construction_department_manager,
      id: response.construction_department_manager_id,
    },
    {
      role: '交付经理',
      name: response.construction_project_manager,
      id: response.construction_project_manager_id
    },
    {
      role: '服务经理',
      name: response.maintenance_manager,
      id: response.maintenance_manager_id
    },
    {
      role: '省端项目主管',
      name: response.project_supervisor,
      id: response.project_supervisor_id
    }
  ])

  // 采购信息
  const purchaseDescs = reactive(response.purchase)

  // 其他
  const otherDescs = reactive([
    {
      label: '复盘分类',
      content: response.review_category
    },
    {
      label: '是否有问题',
      content: response.review_question ? "是" : "否"
    },
    {
      label: '原因',
      content: response.review_cause
    },
    {
      label: '解决措施',
      content: response.review_solution_measure
    },
    {
      label: '备注',
      content: response.review_comment
    }
  ])

  // 团队成员信息
  const membersTableData = reactive(response.members)

  // 附件信息
  const filesTableData = reactive(response.files)

  // ICT售前补充信息
  const ictSupplementDescs = reactive([
    {
      label: '项目名称',
      content: response.ictSupplementInfo?.[0]?.project_name || ''
    },
    {
      label: '项目编号',
      content: response.ictSupplementInfo?.[0]?.project_number || ''
    },
    {
      label: '项目化核算编码',
      content: response.ictSupplementInfo?.[0]?.project_code || ''
    },
    {
      label: '所属地市',
      content: response.ictSupplementInfo?.[0]?.region || ''
    },
    {
      label: '商机名称',
      content: response.ictSupplementInfo?.[0]?.business_number || ''
    },
    {
      label: '项目状态',
      content: response.ictSupplementInfo?.[0]?.project_status || ''
    },
    {
      label: '资产权属',
      content: response.ictSupplementInfo?.[0]?.asset_own || ''
    },
    {
      label: '合同期总收入（元）',
      content: response.ictSupplementInfo?.[0]?.contract_amount || ''
    },
    {
      label: '项目总投入(含税：元)',
      content: response.ictSupplementInfo?.[0]?.project_amount || ''
    },
    {
      label: '项目总投入(不含税：元)',
      content: response.ictSupplementInfo?.[0]?.project_amount_no_tax || ''
    },
    {
      label: '专线投资金额(含税：元)',
      content: response.ictSupplementInfo?.[0]?.special_amount || ''
    },
    {
      label: '专线投资金额(不含税：元)',
      content: response.ictSupplementInfo?.[0]?.special_amount_no_tax || ''
    },
    {
      label: '信息化切块资金投资(含税：元)',
      content: response.ictSupplementInfo?.[0]?.investment_amount || ''
    },
    {
      label: '信息化切块资金投资(不含税：元)',
      content: response.ictSupplementInfo?.[0]?.investment_amount_no_tax || ''
    },
    {
      label: '地市成本投入(IT部分)(含税：元)',
      content: response.ictSupplementInfo?.[0]?.region_cost_it || ''
    },
    {
      label: '地市成本投入(IT部分)(不含税：元)',
      content: response.ictSupplementInfo?.[0]?.region_cost_it_no_tax || ''
    },
    {
      label: '净现值',
      content: response.ictSupplementInfo?.[0]?.net_present || ''
    },
    {
      label: '净现值率(%)',
      content: response.ictSupplementInfo?.[0]?.net_present_rate || ''
    },
    {
      label: '内部收益率(IRR)',
      content: response.ictSupplementInfo?.[0]?.inner_income_rate || ''
    },
    {
      label: '动态回收期(年)',
      content: response.ictSupplementInfo?.[0]?.dynamic_recover_stage || ''
    },
    {
      label: '静态回收期(年)',
      content: response.ictSupplementInfo?.[0]?.static_recover_stage || ''
    },
    {
      label: '业务合同年限(年)',
      content: response.ictSupplementInfo?.[0]?.contract_period || ''
    },
    {
      label: '地市成本投入(ICT主营)',
      content: response.ictSupplementInfo?.[0]?.region_cost_ict_cost || ''
    },
    {
      label: '地市成本投入(ICT非主营)',
      content: response.ictSupplementInfo?.[0]?.region_cost_ict_no_cost || ''
    },
    {
      label: '毛利率',
      content: response.ictSupplementInfo?.[0]?.gross_rate || ''
    },
    {
      label: 'IT部分利润率',
      content: response.ictSupplementInfo?.[0]?.it_rate || ''
    },
    {
      label: '分年维度-第一年',
      content: response.ictSupplementInfo?.[0]?.income_year_one || ''
    },
    {
      label: '分年维度-第二年',
      content: response.ictSupplementInfo?.[0]?.income_year_two || ''
    },
    {
      label: '分年维度-第三年',
      content: response.ictSupplementInfo?.[0]?.income_year_three || ''
    },
    {
      label: '分年维度-第四年',
      content: response.ictSupplementInfo?.[0]?.income_year_four || ''
    },
    {
      label: '分年维度-第五年',
      content: response.ictSupplementInfo?.[0]?.income_year_five || ''
    },
    {
      label: '分科目维度-其他',
      content: response.ictSupplementInfo?.[0]?.income_subject_other || ''
    },
    {
      label: '分科目维度-ICT',
      content: response.ictSupplementInfo?.[0]?.income_subject_ict || ''
    },
    {
      label: '分科目维度-定制化云',
      content: response.ictSupplementInfo?.[0]?.income_subject_cloud || ''
    },
    {
      label: '分科目维度-大数据',
      content: response.ictSupplementInfo?.[0]?.income_subject_big_data || ''
    },
    {
      label: '分科目维度-5G',
      content: response.ictSupplementInfo?.[0]?.income_subject_cue || ''
    },
    {
      label: '净利润',
      content: response.ictSupplementInfo?.[0]?.net_profit || ''
    },
    {
      label: '项目整体利润率',
      content: response.ictSupplementInfo?.[0]?.project_total_profit_rate || ''
    },
    {
      label: '折现率',
      content: response.ictSupplementInfo?.[0]?.dicount_rate || ''
    },
    {
      label: '变更时间',
      content: response.ictSupplementInfo?.[0]?.change_time || ''
    }
  ]);

  return {
    // 项目基本信息
    projectBasicDescs,
    // 项目详情信息
    // 基本信息
    basicInfoDescs,
    // 财务信息
    financeDescs,
    // 合同信息
    contractDescs,
    // 客户信息
    customerDescs,
    // 团队信息
    teamDescs,
    // 关键人信息
    keyPersonTableData,
    // 采购信息
    purchaseDescs,
    // 其他
    otherDescs,
    // 团队成员信息
    membersTableData,
    // 附件信息
    filesTableData,
    // ICT售前补充信息
    ictSupplementDescs
  }
}